
class DataUtil{

  //字符串是否为空或null
  static bool isStringEmpty(String str){
    return str == null || str.length<1;
  }

  //list 是否为空或null
  static bool isListEmpty(List lst){
    return lst == null || lst.length<1;
  }

  //Map是否为空或null
  static bool isMapEmpty(Map map){
    return map == null || map.length<1;
  }

  //list转化
  static List<T> convertListToList<T>(List list,Function func){
    List<T> listRes = [];
    if(list == null)return listRes;
    list.forEach((element) { listRes.add(func(element)); });
    return listRes;
  }

  //int ---> 指定长度的hex (如指定长度为6的情况,0x000001 0x001234, 0xefab23)
  String intToFormatHex(int num) {
    String hexString = num.toRadixString(16);
    String formatString = hexString.padLeft(6, "0");
    return formatString;
  }

}